package com.serializable_and_deserialize;

import java.io.Serializable;

/**
 * @ClassName: User
 * @Author: ZhangYue26
 * @Description:
 * @Date: 2020-11-23
 */
public class User implements Serializable {
    private int age;
    private String name;
    private Role role;

    public static class Role implements Serializable{
        private int level;
        private Boolean isAdmin;
        private String roleName;

        public Role(int level, Boolean isAdmin, String roleName) {
            this.level = level;
            this.isAdmin = isAdmin;
            this.roleName = roleName;
        }

        public Role() {
        }

        public int getLevel() {
            return level;
        }

        public void setLevel(int level) {
            this.level = level;
        }

        public Boolean getAdmin() {
            return isAdmin;
        }

        public void setAdmin(Boolean admin) {
            isAdmin = admin;
        }

        public String getRoleName() {
            return roleName;
        }

        public void setRoleName(String roleName) {
            this.roleName = roleName;
        }

        @Override
        public String toString() {
            return "Role{" +
                    "level=" + level +
                    ", isAdmin=" + isAdmin +
                    ", roleName='" + roleName + '\'' +
                    '}';
        }
    }

    public User(int age, String name, Role role) {
        this.age = age;
        this.name = name;
        this.role = role;
    }

    public User() {
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return "User{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", role=" + role +
                '}';
    }
}
